package com.enation.app.javashop.core.goods.model.vo;

import java.io.Serializable;

/**
 * 商品库存vo
 * @author fk
 * @version v6.4
 * @since v6.4
 * 2017年9月7日 上午11:23:16
 */
public class GoodsQuantityVO implements Serializable{

	/**
	 *
	 */
	private static final long serialVersionUID = -2657189345989798891L;

	private Integer goodsId;

	private Integer skuId;

	private Integer quantity;

	private Integer enableQuantity;

	public GoodsQuantityVO() {}


	public GoodsQuantityVO(Integer goodsId, Integer skuId, Integer quantity, Integer enableQuantity) {
		super();
		this.goodsId = goodsId;
		this.skuId = skuId;
		this.quantity = quantity;
		this.enableQuantity = enableQuantity;
	}


	public Integer getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(Integer goodsId) {
		this.goodsId = goodsId;
	}

	public Integer getSkuId() {
		return skuId;
	}

	public void setSkuId(Integer skuId) {
		this.skuId = skuId;
	}

	public Integer getQuantity() {

		if ( quantity==null){
			return 0;
		}

		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Integer getEnableQuantity() {
		if ( enableQuantity==null){
			return 0;
		}return enableQuantity;
	}

	public void setEnableQuantity(Integer enableQuantity) {
		this.enableQuantity = enableQuantity;
	}


	@Override
	public String toString() {
		return "GoodsQuantityVO [goodsId=" + goodsId + ", skuId=" + skuId + ", quantity=" + quantity
				+ ", enableQuantity=" + enableQuantity + "]";
	}


	@Override
	public boolean equals(Object o) {
		if (this == o){
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}

		GoodsQuantityVO that = (GoodsQuantityVO) o;

		if (!goodsId.equals(that.goodsId)) {
			return false;
		}
		if (!skuId.equals(that.skuId)) {
			return false;
		}
		if (!quantity.equals(that.quantity)) {
			return false;
		}
		return enableQuantity.equals(that.enableQuantity);
	}

	@Override
	public int hashCode() {
		int result = goodsId.hashCode();
		result = 31 * result + skuId.hashCode();
		result = 31 * result + quantity.hashCode();
		result = 31 * result + enableQuantity.hashCode();
		return result;

	}
}

